﻿/*
 * @author: wizardc
 */

using UnityEditor;
using UnityEngine;

namespace DouEditor.Asset
{
    /// <summary>
    /// 音频文件处理
    /// </summary>
    public class AudioMonitor : AssetPostprocessor
    {
        void OnPreprocessAudio()
        {
            AudioImporterSampleSettings audioSetting = new AudioImporterSampleSettings();
            audioSetting.loadType = AudioClipLoadType.CompressedInMemory;
            audioSetting.compressionFormat = AudioCompressionFormat.Vorbis;
            audioSetting.quality = 0.1f;
            audioSetting.sampleRateSetting = AudioSampleRateSetting.OptimizeSampleRate;

            AudioImporter audio = assetImporter as AudioImporter;
            audio.forceToMono = true;
            audio.defaultSampleSettings = audioSetting;
        }

        void OnPostprocessAudio()
        {
        }
    }
}
